package com.apes.scm.masterdata.product.model;

import com.apes.framework.jpa.DefaultPersistListener;
import com.apes.framework.jpa.Model;
import com.apes.framework.jpa.comment.Comment;
import com.apes.scm.masterdata.enumeration.model.Enumeration;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.annotations.SelectBeforeUpdate;

import javax.persistence.*;

/**
 * 功能：品类服务类型
 *
 * @Auther: linwz
 * @Date: 2018/8/10 16:41
 */
@Getter
@Setter
@SelectBeforeUpdate
@DynamicInsert
@DynamicUpdate
@Entity
@EntityListeners(DefaultPersistListener.class)
@Table(name = "mas_serve_category")
public class ServeCategory extends Model {

    @Id
    @Column(name = "id", length = 16)
    @Comment("服务类型编码")
    private String id;  //品类服务类型编码

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "serve_type_id", referencedColumnName = "id",nullable = false)
    @Comment("服务类型")
    private ServeType serveType; //服务类型

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "classify_id", referencedColumnName = "id",nullable = false)
    @Comment("商品分类编码")
    private Classify classify; //商品分类

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "station_type", referencedColumnName = "id")
    private Enumeration stationType;
}
